package com.fac.controller.user;

import com.fac.dto.RepairOrderCreateDTO;
import com.fac.result.Result;
import com.fac.service.RepairOrderService;
import com.fac.vo.RepairOrderCreateVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 用户端维修订单Controller
 */
@RestController("userRepairOrderController")
@RequestMapping("/user/repairOrders")
@Api(tags = "用户端-维修订单接口")
@Slf4j
public class RepairOrderController {

    @Autowired
    private RepairOrderService repairOrderService;

    /**
     * 报修申请
     *
     * @param createDTO 创建订单信息
     * @return 创建结果
     */
    @PostMapping
    @ApiOperation("报修申请")
    public Result<RepairOrderCreateVO> create(@RequestBody RepairOrderCreateDTO createDTO) {
        log.info("报修申请：{}", createDTO);
        RepairOrderCreateVO orderVO = repairOrderService.create(createDTO);
        return Result.success(orderVO);
    }
} 